package lesson;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

public class Demo {
    public static void main(String[] args) throws IOException, DocumentException {
        //1.获取一个解析器对象
        SAXReader saxReader = new SAXReader();

        //2.利用解析器把xml文件加载到内存中，并返回一个文档对象
        Document document = saxReader.read(new File("D:\\Java\\PROJECT\\Advance\\Day18\\src\\lesson\\person.xml"));

        //3.获取根标签
        Element rootElement = document.getRootElement();
        //4.通过跟标签获取student标签
        List elements = rootElement.elements();
        System.out.println(elements.size());


    }
}
